/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.controller;

import cn.ac.iie.di.subThread.ListernThread;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

/**
 *
 * @author zhangyun
 */
public class Controller {

    static Logger logger = null;
    
    static {
        PropertyConfigurator.configure(ClassLoader.getSystemClassLoader().getResource("log4j.properties"));
        logger = Logger.getLogger(Controller.class);
    }

    public static void main(String[] args) {
        
        //start.sh启动
//        Controller.confPath = args[0];
        //“运行”启动
//        Controller.confPath = "E:\\数据接入\\maven\\AD.IC-odata-exchange-controller\\src\\main\\resources";
        
        //读取配置文件
//        PropertyConfigurator.configure(Controller.confPath + "/log4j.properties");

        //启动监听，接受xml
        logger.info("server start!");
        ListernThread lsnThread = new ListernThread();
        Thread listernThread = new Thread(lsnThread);
        listernThread.start();

        //心跳，检测存在
        while (true) {
            try {
                Thread.sleep(3000);
                logger.debug("heartbeat up!");
            } catch (InterruptedException ex) {
                logger.error("sleep error!", ex);
            }
        }
    }
}
